using FarPoint.Win;
using FarPoint.Win.Spread;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace Spread.Sparkline.Features
{
    public partial class GaugeKPISparkline : Spread.Common.Features.Sample.BaseSampleControl
    {
        public GaugeKPISparkline()
        {
            InitializeComponent();
            Name = "Gauge KPI";
            InitControls();
            _fpSpread.ScrollBarTrackPolicy = ScrollBarTrackPolicy.Both;
            InitGaugeKPISparklineCircle(_fpSpread.Sheets[0]);
            InitGaugeKPISparklineVertical(_fpSpread.Sheets[1]);
            InitGaugeKPISparklineHorizontal(_fpSpread.Sheets[2]);
        }

        #region Private Methods
        private void InitGaugeKPISparklineCircle(SheetView sheetView)
        {
            var worksheet = sheetView.AsWorksheet();
            worksheet.Name = "Circle";

            worksheet.SetValue(1, 0, new object[,] {
                { "Teams", "Team A", "Team B", "Team C", "Team D", "Team E", "Team F"},
                { "Goal", 25000, 22000, 45000, 39000, 49000, 16000},
                { "Amount Raised", 24000, 23000, 45500, 29000, 49500, 25000},
                { "Diagram", null, null, null, null, null, null}
            });

            //styling
            for (var i = 0; i < 7; i++)
            {
                worksheet.Columns[$"{(char)(i + 65)}"].ColumnWidth = 300;
            }
            worksheet.Rows["5"].RowHeight = 300;
            worksheet.Rows["1"].RowHeight = 35;
            worksheet.Cells["A1:G1"].Merge();

            worksheet.Cells["A1"].Value = "Fundraising Teams KPI";
            worksheet.Cells["A1"].Font.ApplyFont(new GrapeCity.Spreadsheet.Font() { Name = "Arial", Size = 15 });
            worksheet.Cells["A1"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Center;
            sheetView.Cells["A1"].BackColor = Color.Gray;
            sheetView.Cells["A1"].ForeColor = Color.White;


            worksheet.Cells["A2:A5"].Font.ApplyFont(new GrapeCity.Spreadsheet.Font() { Name = "Arial", Size = 11, Bold = true });
            worksheet.Cells["A2:A5"].Borders.ApplyBorder(new GrapeCity.Spreadsheet.Border()
            {
                Right = new GrapeCity.Spreadsheet.BorderLine(GrapeCity.Spreadsheet.BorderLineStyle.Thin, GrapeCity.Spreadsheet.Color.FromKnownColor(GrapeCity.Core.KnownColor.Black))
            });

            worksheet.Cells["A2:A5"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Top;

            worksheet.Cells["B2:G4"].HorizontalAlignment = GrapeCity.Spreadsheet.HorizontalAlignment.Center;
            worksheet.Cells["B3:G4"].NumberFormat = "$0,K";

            worksheet.Cells["B5"].Formula2 = "GAUGEKPISPARKLINE(B3,B4,0,50000,TRUE,TEXT(B3,\"$0,K\"),TEXT(B4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,-90,90,0.5,0,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["C5"].Formula2 = "GAUGEKPISPARKLINE(C3,C4,0,50000,TRUE,TEXT(C3,\"$0,K\"),TEXT(C4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,-90,90,0.5,0,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D5"].Formula2 = "GAUGEKPISPARKLINE(D3,D4,0,50000,TRUE,TEXT(D3,\"$0,K\"),TEXT(D4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,-90,90,0.5,0,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["E5"].Formula2 = "GAUGEKPISPARKLINE(E3,E4,0,50000,TRUE,TEXT(E3,\"$0,K\"),TEXT(E4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,-90,90,0.5,0,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["F5"].Formula2 = "GAUGEKPISPARKLINE(F3,F4,0,50000,TRUE,TEXT(F3,\"$0,K\"),TEXT(F4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,-90,90,0.5,0,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["G5"].Formula2 = "GAUGEKPISPARKLINE(G3,G4,0,50000,TRUE,TEXT(G3,\"$0,K\"),TEXT(G4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,-90,90,0.5,0,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
        }

        private void InitGaugeKPISparklineVertical(SheetView sheetView)
        {
            var worksheet = sheetView.AsWorksheet();
            worksheet.Name = "Vertical";

           worksheet.SetValue(1, 0, new object[,] {
                { "Teams", "Team A", "Team B", "Team C", "Team D", "Team E", "Team F"},
                { "Goal", 25000, 22000, 45000, 39000, 49000, 16000},
                { "Amount Raised", 24000, 23000, 45500, 29000, 49500, 25000},
                { "Diagram", null, null, null, null, null, null}
            });

            //styling
            for (var i = 0; i < 7; i++)
            {
                worksheet.Columns[$"{(char)(i + 65)}"].ColumnWidth = 250;
            }
            worksheet.Rows["5"].RowHeight = 300;
            worksheet.Rows["1"].RowHeight = 35;
            worksheet.Cells["A1:G1"].Merge();

            worksheet.Cells["A1"].Value = "Fundraising Teams KPI";
            worksheet.Cells["A1"].Font.ApplyFont(new GrapeCity.Spreadsheet.Font() { Name = "Arial", Size = 15 });
            worksheet.Cells["A1"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Center;
            sheetView.Cells["A1"].BackColor = Color.Gray;
            sheetView.Cells["A1"].ForeColor = Color.White;


            worksheet.Cells["A2:A5"].Font.ApplyFont(new GrapeCity.Spreadsheet.Font() { Name = "Arial", Size = 11, Bold = true });
            worksheet.Cells["A2:A5"].Borders.ApplyBorder(new GrapeCity.Spreadsheet.Border()
            {
                Right = new GrapeCity.Spreadsheet.BorderLine(GrapeCity.Spreadsheet.BorderLineStyle.Thin, GrapeCity.Spreadsheet.Color.FromKnownColor(GrapeCity.Core.KnownColor.Black))
            });

            worksheet.Cells["A2:A5"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Top;

            worksheet.Cells["B2:G4"].HorizontalAlignment = GrapeCity.Spreadsheet.HorizontalAlignment.Center;
            worksheet.Cells["B3:G4"].NumberFormat = "$0,K";

            worksheet.Cells["B5"].Formula2 = "GAUGEKPISPARKLINE(B3,B4,0,50000,TRUE,TEXT(B3,\"$0,K\"),TEXT(B4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,1,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["C5"].Formula2 = "GAUGEKPISPARKLINE(C3,C4,0,50000,TRUE,TEXT(C3,\"$0,K\"),TEXT(C4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,1,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D5"].Formula2 = "GAUGEKPISPARKLINE(D3,D4,0,50000,TRUE,TEXT(D3,\"$0,K\"),TEXT(D4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,1,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["E5"].Formula2 = "GAUGEKPISPARKLINE(E3,E4,0,50000,TRUE,TEXT(E3,\"$0,K\"),TEXT(E4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,1,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["F5"].Formula2 = "GAUGEKPISPARKLINE(F3,F4,0,50000,TRUE,TEXT(F3,\"$0,K\"),TEXT(F4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,1,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["G5"].Formula2 = "GAUGEKPISPARKLINE(G3,G4,0,50000,TRUE,TEXT(G3,\"$0,K\"),TEXT(G4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,1,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
        }

        private void InitGaugeKPISparklineHorizontal(SheetView sheetView)
        {
            var worksheet = sheetView.AsWorksheet();
            worksheet.Name = "Horizontal";

            worksheet.SetValue(1, 0, new object[,] {
                { "Teams", "Goal", "Amount Raised", "Diagram" },
                { "Team A", 25000, 24000, null },
                { "Team B", 22000, 23000, null},
                { "Team C", 45000, 45500, null},
                { "Team D", 39000, 29000, null},
                {"Team E", 49000, 49500, null},
                {"Team F", 16000, 25000, null}
             });

            //styling
            for (var i = 0; i < 3; i++)
            {
                worksheet.Columns[$"{(char)(65 + i)}"].ColumnWidth = 150;
            }
            worksheet.Rows["1"].RowHeight = 35;
            worksheet.Rows["2"].RowHeight = 30;

            for (int i = 2; i < 8; i++)
            {
                worksheet.Rows[$"{i + 1}"].RowHeight = 80;
            }

            worksheet.Columns["D"].ColumnWidth = 260;
            worksheet.Cells["A1:D1"].Merge();

            worksheet.Cells["A1"].Value = "Fundraising Teams KPI";
            worksheet.Cells["A1"].Font.ApplyFont(new GrapeCity.Spreadsheet.Font() { Name = "Arial", Size = 15 });
            worksheet.Cells["A1"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Center;
            sheetView.Cells["A1"].BackColor = Color.Gray;
            sheetView.Cells["A1"].ForeColor = Color.White;

            worksheet.Cells["A2:D2"].Font.ApplyFont(new GrapeCity.Spreadsheet.Font() { Name = "Arial", Size = 11, Bold = true });
            worksheet.Cells["A2:D2"].Borders.ApplyBorder(new GrapeCity.Spreadsheet.Border()
            {
                Bottom = new GrapeCity.Spreadsheet.BorderLine(GrapeCity.Spreadsheet.BorderLineStyle.Thin, GrapeCity.Spreadsheet.Color.FromKnownColor(GrapeCity.Core.KnownColor.Black))
            });
            worksheet.Cells["A2:D2"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Top;

            worksheet.Cells["B3:C8"].HorizontalAlignment = GrapeCity.Spreadsheet.HorizontalAlignment.Center;
            worksheet.Cells["A2:D8"].VerticalAlignment = GrapeCity.Spreadsheet.VerticalAlignment.Center;
            worksheet.Cells["B3:C8"].NumberFormat = "$0,K";

            worksheet.Cells["D3"].Formula2 = "GAUGEKPISPARKLINE(B3,C3,0,50000,TRUE,TEXT(B3,\"$0,K\"),TEXT(C3,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,2,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D4"].Formula2 = "GAUGEKPISPARKLINE(B4,C4,0,50000,TRUE,TEXT(B4,\"$0,K\"),TEXT(C4,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,2,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D5"].Formula2 = "GAUGEKPISPARKLINE(B5,C5,0,50000,TRUE,TEXT(B5,\"$0,K\"),TEXT(C5,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,2,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D6"].Formula2 = "GAUGEKPISPARKLINE(B6,C6,0,50000,TRUE,TEXT(B6,\"$0,K\"),TEXT(C6,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,2,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D7"].Formula2 = "GAUGEKPISPARKLINE(B7,C7,0,50000,TRUE,TEXT(B7,\"$0,K\"),TEXT(C7,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,2,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
            worksheet.Cells["D8"].Formula2 = "GAUGEKPISPARKLINE(B8,C8,0,50000,TRUE,TEXT(B8,\"$0,K\"),TEXT(C8,\"$0,K\"),TEXT(0,\"$0,K\"),TEXT(50000,\"$0,K\"),,0,0,0,2,{0,10000,\"#F7A711\"},{10000,25000,\"#BBBBBB\"},{25000,50000,\"#82BC00\"})";
        }

        private void ApplyChanges()
        {
            var worksheet = _fpSpread.ActiveSheet.AsWorksheet();
            int gaugeType = _fpSpread.ActiveSheetIndex; // same as sheet index
            int start = 1, end = 7;
            if (gaugeType == 2)
            {
                start = 2;
                end = 8;
            }
            for (var i = start; i < end; i++)
            {

                var goalcolumn = Convert.ToChar(65 + i) + "3";
                var actualcolumn = Convert.ToChar(65 + i) + "4";
                var row = 4; var column = i;
                if (gaugeType == 2) //for horizontal gauge
                {
                    goalcolumn = "B" + (i + 1);
                    actualcolumn = "C" + (i + 1);
                    row = i;
                    column = 3;
                }

                worksheet.Cells[$"{(char)(column + 65)}{row + 1}"].Formula2 = $"GAUGEKPISPARKLINE({goalcolumn}, {actualcolumn}, {_txtMin.Text}, {_txtMax.Text},TRUE,TEXT({goalcolumn},\"$0,K\"),TEXT({actualcolumn},\"$0,K\")," +
                    $"TEXT({_txtMin.Text},\"$0,K\"),TEXT({_txtMax.Text},\"$0,K\"),,-90,90,0.5,{gaugeType}," +
                    $"{{ {_txtRng1Start.Text}, {_txtRng1End.Text},\"{_cmbRng1Color.SelectedItem}\" }}," +
                    $"{{{_txtRng2Start.Text},{_txtRng2End.Text},\"{_cmbRng2Color.SelectedItem}\" }}," +
                    $"{{{_txtRng3Start.Text},{_txtRng3End.Text},\"{_cmbRng3Color.SelectedItem}\" }})";
            }
        }

        private void InitControls()
        {
            _cmbRng1Color.DropDownStyle = _cmbRng2Color.DropDownStyle = _cmbRng3Color.DropDownStyle = ComboBoxStyle.DropDownList;
            _cmbRng1Color.DataSource = new string[] { "White", "Black", "Orange", "LightGray", "Gray", "DarkGray", "Green" };
            _cmbRng2Color.DataSource = new string[] { "White", "Black", "Orange", "LightGray", "Gray", "DarkGray", "Green" };
            _cmbRng3Color.DataSource = new string[] { "White", "Black", "Orange", "LightGray", "Gray", "DarkGray", "Green" };
            _cmbRng1Color.SelectedIndex = 2;
            _cmbRng2Color.SelectedIndex = 4;
            _cmbRng3Color.SelectedIndex = 6;

            _txtMin.Text = "0";
            _txtMax.Text = "50000";
            _txtRng1Start.Text = "0";
            _txtRng1End.Text = "10000";
            _txtRng2Start.Text = "10000";
            _txtRng2End.Text = "25000";
            _txtRng3Start.Text = "25000";
            _txtRng3End.Text = "50000";

            _txtMin.LostFocus += OnMinLostFocus;
            _txtMax.LostFocus += OnMaxLostFocus;
            _txtRng1End.LostFocus += OnRange1EndValueLostFocus;
            _txtRng2End.LostFocus += OnRange2EndValueLostFocus;
            _cmbRng1Color.SelectedIndexChanged += OnComboBoxSelectionChanged;
            _cmbRng2Color.SelectedIndexChanged += OnComboBoxSelectionChanged;
            _cmbRng3Color.SelectedIndexChanged += OnComboBoxSelectionChanged;
        }

        #endregion

        #region Event Handlers
        private void OnMaxLostFocus(object sender, EventArgs e)
        {
            if (double.TryParse(_txtMax.Text, out double result))
            {
                _txtRng3End.Text = result.ToString();
                ApplyChanges();
            }
        }

        private void OnRange2EndValueLostFocus(object sender, EventArgs e)
        {
            if (double.TryParse(_txtRng2End.Text, out double result))
            {
                _txtRng3Start.Text = result.ToString();
                ApplyChanges();
            }
        }

        private void OnRange1EndValueLostFocus(object sender, EventArgs e)
        {
            if (double.TryParse(_txtRng1End.Text, out double result))
            {
                _txtRng2Start.Text = result.ToString();
                ApplyChanges();
            }
        }

        private void OnMinLostFocus(object sender, EventArgs e)
        {
            if (double.TryParse(_txtMin.Text, out double result))
            {
                _txtRng1Start.Text = result.ToString();
                ApplyChanges();
            }
        }

        private void OnComboBoxSelectionChanged(object sender, EventArgs e)
        {
            ApplyChanges();
        }
        #endregion
    }
}


//
//GaugeKPISparkline.Designer.cs
//



namespace Spread.Sparkline.Features
{
    partial class GaugeKPISparkline
    {
        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GaugeKPISparkline));
            this._fpSpread = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None, resources.GetObject("resource1"));
            this._fpSpread_Sheet1 = this._fpSpread.GetSheet(0);
            this._fpSpread_Sheet2 = this._fpSpread.GetSheet(1);
            this._fpSpread_Sheet3 = this._fpSpread.GetSheet(2);
            this.label1 = new System.Windows.Forms.Label();
            this.seperator = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.label14 = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
            this.label16 = new System.Windows.Forms.Label();
            this.label17 = new System.Windows.Forms.Label();
            this.label18 = new System.Windows.Forms.Label();
            this._txtMin = new System.Windows.Forms.TextBox();
            this._txtMax = new System.Windows.Forms.TextBox();
            this._txtRng1Start = new System.Windows.Forms.TextBox();
            this._txtRng1End = new System.Windows.Forms.TextBox();
            this._txtRng2Start = new System.Windows.Forms.TextBox();
            this._txtRng2End = new System.Windows.Forms.TextBox();
            this._txtRng3Start = new System.Windows.Forms.TextBox();
            this._txtRng3End = new System.Windows.Forms.TextBox();
            this._cmbRng1Color = new System.Windows.Forms.ComboBox();
            this._cmbRng2Color = new System.Windows.Forms.ComboBox();
            this._cmbRng3Color = new System.Windows.Forms.ComboBox();
            this.pnlMain.SuspendLayout();
            this.pnlControls.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this._fpSpread)).BeginInit();
            this.SuspendLayout();
            // 
            // pnlMain
            // 
            this.pnlMain.Controls.Add(this._fpSpread);
            // 
            // pnlControls
            // 
            this.pnlControls.AutoScroll = true;
            this.pnlControls.Controls.Add(this._cmbRng3Color);
            this.pnlControls.Controls.Add(this._cmbRng2Color);
            this.pnlControls.Controls.Add(this._cmbRng1Color);
            this.pnlControls.Controls.Add(this._txtRng3End);
            this.pnlControls.Controls.Add(this._txtRng3Start);
            this.pnlControls.Controls.Add(this._txtRng2End);
            this.pnlControls.Controls.Add(this._txtRng2Start);
            this.pnlControls.Controls.Add(this._txtRng1End);
            this.pnlControls.Controls.Add(this._txtRng1Start);
            this.pnlControls.Controls.Add(this._txtMax);
            this.pnlControls.Controls.Add(this._txtMin);
            this.pnlControls.Controls.Add(this.label18);
            this.pnlControls.Controls.Add(this.label17);
            this.pnlControls.Controls.Add(this.label16);
            this.pnlControls.Controls.Add(this.label15);
            this.pnlControls.Controls.Add(this.label14);
            this.pnlControls.Controls.Add(this.label13);
            this.pnlControls.Controls.Add(this.label12);
            this.pnlControls.Controls.Add(this.label11);
            this.pnlControls.Controls.Add(this.label10);
            this.pnlControls.Controls.Add(this.label9);
            this.pnlControls.Controls.Add(this.label8);
            this.pnlControls.Controls.Add(this.label7);
            this.pnlControls.Controls.Add(this.label6);
            this.pnlControls.Controls.Add(this.label5);
            this.pnlControls.Controls.Add(this.label2);
            this.pnlControls.Controls.Add(this.label4);
            this.pnlControls.Controls.Add(this.label3);
            this.pnlControls.Controls.Add(this.seperator);
            this.pnlControls.Controls.Add(this.label1);
            // 
            // _fpSpread
            // 
            this._fpSpread.AccessibleDescription = "Book1, Sheet1, Row 0, Column 0";
            this._fpSpread.Dock = System.Windows.Forms.DockStyle.Fill;
            this._fpSpread.Font = new System.Drawing.Font("Calibri", 11F);
            this._fpSpread.Location = new System.Drawing.Point(0, 0);
            this._fpSpread.Name = "_fpSpread";
            this._fpSpread.Size = new System.Drawing.Size(477, 487);
            this._fpSpread.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(14, 18);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(100, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Gauge KPI Settings";
            // 
            // seperator
            // 
            this.seperator.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.seperator.BackColor = System.Drawing.Color.DimGray;
            this.seperator.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.seperator.Location = new System.Drawing.Point(17, 121);
            this.seperator.Name = "seperator";
            this.seperator.Size = new System.Drawing.Size(127, 2);
            this.seperator.TabIndex = 1;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(14, 61);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(57, 13);
            this.label3.TabIndex = 2;
            this.label3.Text = "Min Value:";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.Location = new System.Drawing.Point(14, 92);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(60, 13);
            this.label4.TabIndex = 3;
            this.label4.Text = "Max Value:";
            // 
            // label2
            // 
            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.label2.BackColor = System.Drawing.Color.DimGray;
            this.label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.label2.Location = new System.Drawing.Point(17, 41);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(127, 2);
            this.label2.TabIndex = 4;
            // 
            // label5
            // 
            this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.label5.BackColor = System.Drawing.Color.DimGray;
            this.label5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.label5.Location = new System.Drawing.Point(17, 231);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(127, 2);
            this.label5.TabIndex = 5;
            // 
            // label6
            // 
            this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.label6.BackColor = System.Drawing.Color.DimGray;
            this.label6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.label6.Location = new System.Drawing.Point(17, 354);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(127, 2);
            this.label6.TabIndex = 6;
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label7.Location = new System.Drawing.Point(14, 376);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(48, 13);
            this.label7.TabIndex = 7;
            this.label7.Text = "Range 3";
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label8.Location = new System.Drawing.Point(14, 132);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(48, 13);
            this.label8.TabIndex = 8;
            this.label8.Text = "Range 1";
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label9.Location = new System.Drawing.Point(14, 250);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(48, 13);
            this.label9.TabIndex = 9;
            this.label9.Text = "Range 2";
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(14, 156);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(34, 13);
            this.label10.TabIndex = 10;
            this.label10.Text = "Color:";
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(14, 179);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(62, 13);
            this.label11.TabIndex = 11;
            this.label11.Text = "Start Value:";
            // 
            // label12
            // 
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(14, 203);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(59, 13);
            this.label12.TabIndex = 12;
            this.label12.Text = "End Value:";
            // 
            // label13
            // 
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(14, 275);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(34, 13);
            this.label13.TabIndex = 13;
            this.label13.Text = "Color:";
            // 
            // label14
            // 
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(14, 300);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(62, 13);
            this.label14.TabIndex = 14;
            this.label14.Text = "Start Value:";
            // 
            // label15
            // 
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(14, 326);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(59, 13);
            this.label15.TabIndex = 15;
            this.label15.Text = "End Value:";
            // 
            // label16
            // 
            this.label16.AutoSize = true;
            this.label16.Location = new System.Drawing.Point(14, 404);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(34, 13);
            this.label16.TabIndex = 16;
            this.label16.Text = "Color:";
            // 
            // label17
            // 
            this.label17.AutoSize = true;
            this.label17.Location = new System.Drawing.Point(14, 429);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(62, 13);
            this.label17.TabIndex = 17;
            this.label17.Text = "Start Value:";
            // 
            // label18
            // 
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(14, 453);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(59, 13);
            this.label18.TabIndex = 18;
            this.label18.Text = "End Value:";
            // 
            // _txtMin
            // 
            this._txtMin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtMin.Location = new System.Drawing.Point(77, 58);
            this._txtMin.Name = "_txtMin";
            this._txtMin.Size = new System.Drawing.Size(56, 20);
            this._txtMin.TabIndex = 19;
            // 
            // _txtMax
            // 
            this._txtMax.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtMax.Location = new System.Drawing.Point(77, 89);
            this._txtMax.Name = "_txtMax";
            this._txtMax.Size = new System.Drawing.Size(56, 20);
            this._txtMax.TabIndex = 20;
            // 
            // _txtRng1Start
            // 
            this._txtRng1Start.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtRng1Start.Enabled = false;
            this._txtRng1Start.Location = new System.Drawing.Point(78, 176);
            this._txtRng1Start.Name = "_txtRng1Start";
            this._txtRng1Start.Size = new System.Drawing.Size(56, 20);
            this._txtRng1Start.TabIndex = 21;
            // 
            // _txtRng1End
            // 
            this._txtRng1End.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtRng1End.Location = new System.Drawing.Point(78, 200);
            this._txtRng1End.Name = "_txtRng1End";
            this._txtRng1End.Size = new System.Drawing.Size(56, 20);
            this._txtRng1End.TabIndex = 22;
            // 
            // _txtRng2Start
            // 
            this._txtRng2Start.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtRng2Start.Enabled = false;
            this._txtRng2Start.Location = new System.Drawing.Point(78, 297);
            this._txtRng2Start.Name = "_txtRng2Start";
            this._txtRng2Start.Size = new System.Drawing.Size(56, 20);
            this._txtRng2Start.TabIndex = 23;
            // 
            // _txtRng2End
            // 
            this._txtRng2End.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtRng2End.Location = new System.Drawing.Point(78, 323);
            this._txtRng2End.Name = "_txtRng2End";
            this._txtRng2End.Size = new System.Drawing.Size(56, 20);
            this._txtRng2End.TabIndex = 24;
            // 
            // _txtRng3Start
            // 
            this._txtRng3Start.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtRng3Start.Enabled = false;
            this._txtRng3Start.Location = new System.Drawing.Point(78, 426);
            this._txtRng3Start.Name = "_txtRng3Start";
            this._txtRng3Start.Size = new System.Drawing.Size(56, 20);
            this._txtRng3Start.TabIndex = 25;
            // 
            // _txtRng3End
            // 
            this._txtRng3End.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._txtRng3End.Enabled = false;
            this._txtRng3End.Location = new System.Drawing.Point(78, 450);
            this._txtRng3End.Name = "_txtRng3End";
            this._txtRng3End.Size = new System.Drawing.Size(56, 20);
            this._txtRng3End.TabIndex = 26;
            // 
            // _cmbRng1Color
            // 
            this._cmbRng1Color.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._cmbRng1Color.FormattingEnabled = true;
            this._cmbRng1Color.Location = new System.Drawing.Point(78, 149);
            this._cmbRng1Color.Name = "_cmbRng1Color";
            this._cmbRng1Color.Size = new System.Drawing.Size(55, 21);
            this._cmbRng1Color.TabIndex = 27;
            // 
            // _cmbRng2Color
            // 
            this._cmbRng2Color.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._cmbRng2Color.FormattingEnabled = true;
            this._cmbRng2Color.Location = new System.Drawing.Point(77, 272);
            this._cmbRng2Color.Name = "_cmbRng2Color";
            this._cmbRng2Color.Size = new System.Drawing.Size(56, 21);
            this._cmbRng2Color.TabIndex = 28;
            // 
            // _cmbRng3Color
            // 
            this._cmbRng3Color.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this._cmbRng3Color.FormattingEnabled = true;
            this._cmbRng3Color.Location = new System.Drawing.Point(77, 401);
            this._cmbRng3Color.Name = "_cmbRng3Color";
            this._cmbRng3Color.Size = new System.Drawing.Size(56, 21);
            this._cmbRng3Color.TabIndex = 29;
            // 
            // GaugeKPISparkline
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Name = "GaugeKPISparkline";
            this.pnlMain.ResumeLayout(false);
            this.pnlControls.ResumeLayout(false);
            this.pnlControls.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this._fpSpread)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private FarPoint.Win.Spread.FpSpread _fpSpread;
        private FarPoint.Win.Spread.SheetView _fpSpread_Sheet1;
        private FarPoint.Win.Spread.SheetView _fpSpread_Sheet2;
        private FarPoint.Win.Spread.SheetView _fpSpread_Sheet3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label seperator;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.Label label17;
        private System.Windows.Forms.Label label16;
        private System.Windows.Forms.TextBox _txtMax;
        private System.Windows.Forms.TextBox _txtMin;
        private System.Windows.Forms.TextBox _txtRng1End;
        private System.Windows.Forms.TextBox _txtRng1Start;
        private System.Windows.Forms.TextBox _txtRng3End;
        private System.Windows.Forms.TextBox _txtRng3Start;
        private System.Windows.Forms.TextBox _txtRng2End;
        private System.Windows.Forms.TextBox _txtRng2Start;
        private System.Windows.Forms.ComboBox _cmbRng3Color;
        private System.Windows.Forms.ComboBox _cmbRng2Color;
        private System.Windows.Forms.ComboBox _cmbRng1Color;
    }
}
